package com.hh.bss.mobile.controller;

import java.io.IOException;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.web.servlet.ModelAndView;

import com.hh.bss.auth.client.OnlineManager;
import com.hh.bss.auth.client.OnlineUser;
import com.hh.bss.base.BaseSpringController;
import com.hh.bss.common.page.Page;
import com.hh.bss.customer.vo.query.CompanyQuery;
import com.hh.bss.project.service.SearchProjectCompanyService;
import com.hh.bss.project.service.SearchProjectCvService;
import com.hh.bss.project.service.SearchProjectService;
import com.hh.bss.project.vo.query.SearchProjectCompanyQuery;
import com.hh.bss.project.vo.query.SearchProjectCvQuery;
import com.hh.bss.project.vo.query.SearchProjectQuery;
@Controller
public class SLController extends BaseSpringController  {

//	内部推荐 http://59.38.111.165:8088/project/contractJobCvRecom/extjobcvrecomlist.do?auth:false&jobId:3485 
//		人选名称，现任公司，现任职务，推荐日期（外）推荐日期（内），手机，电邮
//
//
//		外部推荐http://59.38.111.165:8088/project/contractJobCvRecom/extjobcvrecomlist.do?auth:false&jobId:3485&isEmail:1 
//		人选名称，现任公司，现任职务，推荐日期（外）推荐日期（内），手机，电邮
//
//		JD人选:http://59.38.111.165:8088/project/contractJobCvJd/extlist.do?type=1
//		人选姓名 现任公司 职务 手机 电话 人选进展，发送人 发送时间
//
//		录用offer:http://59.38.111.165:8088/project/contractJobCvOffer/extjobcvofferlist.do?jobId:3485
//		人选姓名，现任公司，现任职位，收到offer时间，预估上班时间，实际上班时间，试用到期日，手机，年薪
//
//		客户面试记录:http://59.38.111.165:8088/project/contractJobCvInterview/extjobcvinterviewlist.do?jobId:3485
//		人选姓名，现任公司，现任职位，实际面试时间，面试官，面试官职位，手机，电邮，面试结果
//
//		===========
//		SL的目标公司：http://59.38.111.165:8088/project/searchProjectCompany/extprojectcompanylist.do?projectId:3410
//		公司简称，电话 城市 机构类型 行业 架构图 人才总数/离职总数 简历人才数 联系人才数量 顾问面试数 推荐人才数
//		SL人选:http://59.38.111.165:8088/project/searchProjectCv/extprojectcvlist.do?projectId:3410
//		姓名 性别 是否有简历 任职公司 职位 行业 年龄 学历 当前所在地 外语能力 薪酬范围 人选标签 手机
	private SearchProjectService searchProjectService;
	private SearchProjectCompanyService searchProjectCompanyService;
	private SearchProjectCvService searchProjectCvService;
	public void setSearchProjectCompanyServiceImpl(SearchProjectCompanyService service) {
		this.searchProjectCompanyService = service;
	}
	public void setSearchProjectServiceImpl(SearchProjectService service) {
		this.searchProjectService = service;
	}
	public void setSearchProjectCvServiceImpl(SearchProjectCvService service) {
		this.searchProjectCvService = service;
	}	
	
	public ModelAndView extlist(HttpServletRequest request, HttpServletResponse response, SearchProjectQuery searchProjectQuery) throws IOException {
		OnlineManager onlineManager = super.getOnlineManager(request, response);
		if (onlineManager != null) {
			OnlineUser onlineUser = onlineManager.getOnlineUser();
			searchProjectQuery.setOnlineUser(onlineUser);
		}
		Page page = searchProjectService.findProjectPage(searchProjectQuery);
		//query.getPageSize(), query.getPageNumber()
		ModelAndView mv = new ModelAndView();
		mv.setViewName("/mobile/sl/slPage");
		
		mv.addObject("pages", page);
		mv.addObject("query", searchProjectQuery);
		response.setCharacterEncoding("UTF-8");
		return mv;
		
	}
	public ModelAndView projectCompanyPage(HttpServletRequest request, HttpServletResponse response,SearchProjectCompanyQuery searchProjectCompanyQuery) throws IOException {
		
		Page page = searchProjectCompanyService.findProjectCompanyPage(searchProjectCompanyQuery);
		//query.getPageSize(), query.getPageNumber()
		ModelAndView mv = new ModelAndView();
		mv.setViewName("/mobile/sl/projectCompanyPage");
		
		mv.addObject("pages", page);
		response.setCharacterEncoding("UTF-8");
		return mv;
		
	}	
     public ModelAndView projectCvPage(HttpServletRequest request, HttpServletResponse response,SearchProjectCvQuery searchProjectCvQuery) throws IOException {
    	 OnlineManager onlineManager=super.getOnlineManager(request, response);
 		if (onlineManager!=null){
 			OnlineUser onlineUser=onlineManager.getOnlineUser();
 			searchProjectCvQuery.setOnlineUser(onlineUser);
 		}
    	 Page page = searchProjectCvService.findProjectCvPage(searchProjectCvQuery);
		//query.getPageSize(), query.getPageNumber()
		ModelAndView mv = new ModelAndView();
		mv.setViewName("/mobile/sl/projectCvPage");
		
		mv.addObject("pages", page);
		response.setCharacterEncoding("UTF-8");
		return mv;
		
	}
	public ModelAndView slDetail(HttpServletRequest request, HttpServletResponse response ) throws IOException {
		
		ModelAndView mv = new ModelAndView();
		mv.setViewName("/mobile/sl/slDetail");		
		mv.addObject("id", request.getParameter("id"));
		response.setCharacterEncoding("UTF-8");
		return mv;
		
	}
}
